#!/bin/sh

@charonbindir@/charon > /tmp/charon.$$
read CHARON_CURRENCY CHARON_AMOUNT dummy CHARON_QUANTUM < /tmp/charon.$$
rm /tmp/charon.$$

cat <<EOF
Content-Type: text/html
Pragma: no-cache

<HTML>
<HEAD>
<TITLE>Access Points in SPAAAACE...</TITLE>

<LINK REL="stylesheet" TYPE="text/css" HREF="../charon.css"/>
<STYLE TYPE="text/css">
<!--
-->
</STYLE>
<SCRIPT TYPE="text/javascript" LANG="javascript">
<!--
function checkCrypto() {
	if((typeof(window.crypto) == 'undefined') ||
		(typeof(window.crypto.signText) == 'undefined')) {
		window.document.getElementById("cryptomessage").className = "paused";
	}
}
-->
</SCRIPT>
</HEAD><BODY onLoad="javascript:checkCrypto()">
<DIV CLASS="main">

<H2 CLASS="center">Charon Wireless Community Network</H2>

<P>Welcome to this corner of the wireless universe. You are connected to a WRT54G access point running <A HREF="http://wiki.rcpt.to/">Charon</A>, a community resource.</P>

<NOSCRIPT>
<P>You appear to have Javascript disabled in your browser. You will need a modern browser with Javascript enabled and full cryptographic support to utilize some of the functions of this site.</P>
</NOSCRIPT>
<DIV ID="cryptomessage" CLASS="optionalMessage">
<P>Your browser appears to lack support for the <b>crypto.signText</b> function. This is a key component for being able to log on to this site to access the Internet. The ideal modern web browser with full cryptographic support is <b>Firefox</b>. You can <A HREF="http://firefox.rcpt.to/firefox/">install it now</A> if you do not already have it.</P>
<FORM ACTION="http://firefox.rcpt.to/firefox/" CLASS="center">
<INPUT TYPE="submit" VALUE="Download Firefox"/>
</FORM>
</DIV>

<P>From here you can access local resources or connect to the internet. Internet connectivity will be charged at <b>$CHARON_CURRENCY $CHARON_AMOUNT per $CHARON_QUANTUM bytes transferred</b>.</P>
<FORM ACTION="../charon.html" CLASS="center">
<INPUT TYPE="submit" VALUE="Connect to Internet"/>
</FORM>

EOF


[ -n "$CHARON_PREPAID" ] && cat <<EOF

<P>If you have not previously used the <b>mikolaj.cx</b> payment
service, you will be prompted to create an account. If you would prefer not to use your credit card during this process, you can also <b>pre-pay with cash</b>. This pre-payment can be used here for Internet access and any other access point or online service accepting payments through <b>mikolaj.cx</b>.</P>

<FORM ACTION="prepaid.cgi" CLASS="center">
<INPUT TYPE="submit" VALUE="Pre-pay for access"/>
</FORM>

EOF

cat <<EOF
</DIV>
</BODY></HTML>
EOF
